﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sociedad.DAL
{
    public class UsuarioDAL
    {
        EntityConnectionSOA context = new EntityConnectionSOA();

        public vw_Listar_UsuarioRol Verificar_Acceso(String pUser, String pClave)
        {
            vw_Listar_UsuarioRol userRol = new vw_Listar_UsuarioRol();
            try
            {
                var user = from usr in context.vw_Listar_UsuarioRol
                           where usr.usr_Codigo == pUser && usr.usr_Clave == pClave
                           select usr;
                if (user.Count() > 0 )
                {
                    userRol = user.First();
                }
                else
                {
                    userRol = null;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return userRol;
        }
    }
}
